import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';

import { LoginDto } from 'src/app/dto/login.dto';

const httpOptions = {
  headers: new HttpHeaders({
    'Content-Type': 'application/json'
  })
};

@Injectable({
  providedIn: 'root'
})
export class LoginService {
  constructor(private http: HttpClient) {}

  getToken(loginDto: LoginDto) {
    return this.http.post<any>('/api/login', loginDto, httpOptions).pipe();
  }
}
